#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/8/1 21:43
# @Author  : huidong.bai
# @File    : mongo_logger.py
# @Software: PyCharm
# @Mail    : MasterBai2018@outlook.com

import logging.config


class MyLogger:
    def __init__(self):
        self._logger = None
        self.__load_config()

    def __load_config(self):
        logging.config.fileConfig('conf/logging.ini')
        self._logger = logging.getLogger('my_logger')

    def set_log_path(self, log_path):
        file_handler = self._logger.handlers[0]
        file_handler.filename = log_path

    def get_logger(self):
        return self._logger
